package com.ojoin.trade.common_core.web.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.ojoin.trade.common.exception.BusinessException;
import com.ojoin.trade.common.exception.DaoException;
import com.ojoin.trade.common.web.dao.impl.BaseDaoImpl;
import com.ojoin.trade.common_core.web.dao.TbAreaDao;
import com.ojoin.trade.common_core.web.domain.TbArea;

@Repository
public class TbAreaDaoImpl extends BaseDaoImpl<TbArea> implements TbAreaDao {

	@Override
	public List<TbArea> queryProvinceList() throws BusinessException {
		String mapMethodName = "queryProvinceList";
		try {
			return this.sqlSessionTemplate.selectList(getSqlName(mapMethodName));
		} catch (Exception e) {
			throw new DaoException(String.format("查询省的信息出错！语句：%s",
					getSqlName(mapMethodName)), e);
		}
	}

	@Override
	public List<TbArea> queryCity(String parentid) throws BusinessException {
		String mapMethodName = "queryCity";
		try {
			return this.sqlSessionTemplate.selectList(getSqlName(mapMethodName),
					parentid);
		} catch (Exception e) {
			throw new DaoException(String.format("查询"+ parentid + "下的市信息出错！语句：%s",
					getSqlName(mapMethodName)), e);
		}
	}

	

}
